package com.saas.vertx.web.verticle.job;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;
import org.springframework.stereotype.Component;

/**
 * @Author: lzqing
 * @Description: vertx定时器
 * @Date: Created in 2021/6/6
 */
@Component
public class JobVerticle extends AbstractVerticle {

    @Override
    public void start(Promise<Void> startPromise) throws Exception {
        this.start();
        getVertx().setPeriodic(100000, id -> {
            System.out.println("timer fired!");
        });
        startPromise.complete();
    }

    @Override
    public void stop(Promise<Void> startPromise) throws Exception {
        this.start();
        startPromise.complete();
    }
}
